package com.myidis.mapper;

import java.util.ArrayList;
import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.myidis.entity.AnalysisTheme;

public interface SubjectAnalyticMapper {


	@Select("SELECT * FROM subject_analytic;")
	@Results({
			@Result(property = "name", column = "subject"),
			@Result(property = "benchmarkValue", column = "benchmarkValue"),
			@Result(property = "industry", column = "industry"),
			@Result(property = "remarks", column = "remarks"),
			@Result(property = "creator", column = "creator"),
			@Result(property = "time", column = "creTime")
	})
	ArrayList<AnalysisTheme> all();

	@Select("SELECT * FROM subject_analytic;")
	@Results({
			@Result(property = "name", column = "subject"),
			@Result(property = "benchmarkValue", column = "benchmarkValue"),
			@Result(property = "industry", column = "industry"),
			@Result(property = "remarks", column = "remarks"),
			@Result(property = "creator", column = "creator"),
			@Result(property = "time", column = "creTime"),
			@Result(property = "compound", column = "compounding"),
			@Result(property = "menu", column = "menu"),
			@Result(property = "CI", column = "CI"),
			@Result(property = "DI", column = "DI"),
			@Result(property = "coIndex", column = "SI"),
	})
	ArrayList<AnalysisTheme> detail();


	@Select("SELECT subject,benchmarkValue FROM subject_analytic;")
	@Results({
		@Result(property = "name", column = "subject"),
		@Result(property = "benchmarkValue", column = "benchmarkValue")
		
	})
	ArrayList<AnalysisTheme> allName();

	@Insert("INSERT intO subject_analytic(subject, benchmarkValue, industry, remarks, creator, creTime, compounding, menu, CI" +
            ", DI, SI)"
			+ " VALUES (#{name}, #{value}, #{industry}, #{remarks}, #{creator}, #{time}, " +
            "#{compound}, #{menu}, #{CI}, #{DI}, #{coIndex});")
	int insert(AnalysisTheme add);

	@Update("UPDATE subject_analytic SET  subject = #{value}, industry = #{industry}, "
			+ "remarks = #{remarks}, creator = #{creator}, creTime = #{time}, compounding = #{compound}, menu = #{menu}," +
            "CI = #{CI}, DI = #{DI}, SI =  #{coIndex} WHERE subject = #{name};")
	int update(AnalysisTheme add);

	@Delete("DELETE FROM subject_analytic WHERE subjcet = #{name}")
	int delete(String name);
}